<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // 获取请求参数的键值对
        let query_search = window.location.search;
        if (query_search.startsWith('?')) {
            query_search = query_search.substr(1);
        }
        let key_value_pairs = query_search.split('&');
        let key_value_object = {};
        key_value_pairs.forEach(key_value_pair => {
            let key_value_array = key_value_pair.split('=');
            if (key_value_array.length == 2) {
                key_value_object[key_value_array[0]] = key_value_array[1];
            } else {
                key_value_object[key_value_array[0]] = undefined;
            }
        });
        // 将请求参数键值对写到页面中
        for (const key in key_value_object) {
            if (Object.hasOwnProperty.call(key_value_object, key)) {
                const value = key_value_object[key];
                document.writeln(key + ' = ' + value + ' <br>');
            }
        }
        document.writeln('<hr>');
        document.writeln('Welcome ' + key_value_object['username'] + '<br>');
    </script>

</body>

</html>